package com.sentiwt.data;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.sentiwt.dao.NoiseWordDAO;
import com.sentiwt.jpa.NoiseWord;

@Controller
public class PopulateNoiseWords {
	
	@Autowired
    private NoiseWordDAO noiseWordDao;
	
	/**
	 * Populate noise words
	 * @param args
	 */
	public static void main(String[] args) {
		PopulateNoiseWords pnw = new PopulateNoiseWords();
		pnw.populate();
	}
	
	@RequestMapping(value="/populateNoiseWords")
    public ModelAndView populate(HttpServletRequest request) {
		populate();
		// Prepare the result view (word.jsp):
        return new ModelAndView("noiseWords.jsp", "noiseWordDao", noiseWordDao);
	}
	
	private void populate() {
//	noiseWordDao.save(new NoiseWord("no")); sentiment changer word, not noise
//	noiseWordDao.save(new NoiseWord("not")); sentiment changer word, not noise
		
		noiseWordDao.save(new NoiseWord("a"));
		noiseWordDao.save(new NoiseWord("all"));
		noiseWordDao.save(new NoiseWord("am"));
		noiseWordDao.save(new NoiseWord("an"));
		noiseWordDao.save(new NoiseWord("and"));
		noiseWordDao.save(new NoiseWord("any"));
		noiseWordDao.save(new NoiseWord("are"));
		noiseWordDao.save(new NoiseWord("as"));
		noiseWordDao.save(new NoiseWord("at"));
		noiseWordDao.save(new NoiseWord("be"));
		noiseWordDao.save(new NoiseWord("but"));
		noiseWordDao.save(new NoiseWord("can"));
		noiseWordDao.save(new NoiseWord("did"));
		noiseWordDao.save(new NoiseWord("do"));
		noiseWordDao.save(new NoiseWord("does"));
		noiseWordDao.save(new NoiseWord("for"));
		noiseWordDao.save(new NoiseWord("from"));
		noiseWordDao.save(new NoiseWord("had"));
		noiseWordDao.save(new NoiseWord("has"));
		noiseWordDao.save(new NoiseWord("have"));
		noiseWordDao.save(new NoiseWord("here"));
		noiseWordDao.save(new NoiseWord("how"));
		noiseWordDao.save(new NoiseWord("i"));
		noiseWordDao.save(new NoiseWord("if"));
		noiseWordDao.save(new NoiseWord("in"));
		noiseWordDao.save(new NoiseWord("is"));
		noiseWordDao.save(new NoiseWord("it"));
		noiseWordDao.save(new NoiseWord("of"));
		noiseWordDao.save(new NoiseWord("on"));
		noiseWordDao.save(new NoiseWord("or"));
		noiseWordDao.save(new NoiseWord("so"));
		noiseWordDao.save(new NoiseWord("that"));
		noiseWordDao.save(new NoiseWord("the"));
		noiseWordDao.save(new NoiseWord("then"));
		noiseWordDao.save(new NoiseWord("there"));
		noiseWordDao.save(new NoiseWord("this"));
		noiseWordDao.save(new NoiseWord("to"));
		noiseWordDao.save(new NoiseWord("too"));
		noiseWordDao.save(new NoiseWord("up"));
		noiseWordDao.save(new NoiseWord("use"));
		noiseWordDao.save(new NoiseWord("very"));
		noiseWordDao.save(new NoiseWord("what"));
		noiseWordDao.save(new NoiseWord("when"));
		noiseWordDao.save(new NoiseWord("where"));
		noiseWordDao.save(new NoiseWord("who"));
		noiseWordDao.save(new NoiseWord("why"));
		noiseWordDao.save(new NoiseWord("you"));
	}
	
}
